Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Mark userId nullable (Breaking Change) #85

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

BadCoder1337
Copy link
Contributor

In rare cases userId is null. I'm usure why but it seems to represent a linked account which doesn't started a game.
Raw API response to nameOnPlatform search:

{
    "profileId": "d3dde2ca-7c92-468e-89b4-9dab253225ce",
    "userId": null,
    "platformType": "psn",
    "idOnPlatform": "2072355385337540186",
    "nameOnPlatform": "AreYouAhueliTut"
}

Library response to idOnPlatform search:

  {
    "id": "07c8acb0-542a-4ad0-b0b0-0a714e346584",
    "userId": null,
    "idOnPlatform": "76561198106338458",
    "platform": "steam",
    "nameOnPlatform": "76561198106338458",
    "avatar": {
      "146": "https://ubisoft-avatars.akamaized.net/null/default_146_146.png",
      "256": "https://ubisoft-avatars.akamaized.net/null/default_256_256.png",
      "500": "https://ubisoft-avatars.akamaized.net/null/default_tall.png"
    }
  }

@danielwerg
Copy link
Owner

https://public-ubiservices.ubi.com/v3/profiles?platformType=psn&namesOnPlatform=AreYouAhueliTut
Returns:

{
  "profiles": [
    {
      "profileId": "d3dde2ca-7c92-468e-89b4-9dab253225ce",
      "userId": "c4fdcaf8-3282-45ec-826b-8f91b4dd1794",
      "platformType": "psn",
      "idOnPlatform": "2072355385337540186",
      "nameOnPlatform": "AreYouAhueliTut"
    }
  ]
}

For second case it does indeed returns null for userId

@BadCoder1337
Copy link
Contributor Author

I took the PSN example from my Postman collection, it is outdated. But null is still possible, and it should be represented in types.

src/utils.ts Outdated Show resolved Hide resolved
@danielwerg
Copy link
Owner

Is there a reason we use userId instead of profileId while building avatar url? Can't remember.

@BadCoder1337
Copy link
Contributor Author

Ubisoft doesn't proxy platform avatar behind profileId URL, there's a blank avatar. All trackers (e.g. R6DB) display userId avatar for console profiles.

@BadCoder1337 BadCoder1337 marked this pull request as ready for review June 21, 2022 10:39
@danielwerg
Copy link
Owner

I went down a rabbit hole, even more lost now. How does r6tracker displays pfp for this user: https://r6.tracker.network/profile/xbox/Mono%20wins

@BadCoder1337
Copy link
Contributor Author

Looks like they're using some Xbox API to retrieve platform avatar by idOnPlatform. But this is not r6api.js business, IMHO. Also, I sure there's no similar API for PSN.

@danielwerg danielwerg added the state: breaking A change that requires a major release label Jun 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state: breaking A change that requires a major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants